package com.zzhardy.controller;

import javax.servlet.http.HttpServletRequest;

import com.zzhardy.common.model.ResultResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 阡陌之中
 * @ClassName: IndexController
 * @Description:
 * @date 2021/04/09
 */
@Controller
public class IndexController {
    
    @GetMapping("/")
    public String index(@RequestParam(required = false) Integer pageNumber,
                        @RequestParam(required = false) Integer pageSize,
                        @RequestParam(required = false) String keyword,
                        @RequestParam(required = false) String category,
                        HttpServletRequest request) {
        return "admin/login.html";
    }
    

    @GetMapping("/login")
    public String login(@RequestParam(required = false) Integer pageNumber,
                        @RequestParam(required = false) Integer pageSize,
                        @RequestParam(required = false) String keyword,
                        @RequestParam(required = false) String category,
                        HttpServletRequest request) {
        return "admin/login.html";
    }

    @PostMapping("/user/login")
    @ResponseBody
    public ResultResponse submitLogin(@RequestParam(required = false) String username,
                                      @RequestParam(required = false) String password,
                                      HttpServletRequest request) {
        return ResultResponse.success("登录成功！");
    }

}
